﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using SpaceMan.Physics;
using SpaceMan.Entities.Attachments;

namespace SpaceMan.Entities
{
    public abstract class I_Entity
    {
        protected PHY_Base rigid;
        protected IC_ATT_Attachment baseAttachment;
        public abstract void Initialize(Vector2 Position);
        public int Health;
        public Vector2 Position;
        public bool MarkedForDeletion = false;
        public C_Drawing DrawOperation;
        public abstract void Update();
        virtual public void Draw(SpriteBatch spriteBatch, DrawMode drawMode, Rectangle DrawSpace)
        {
            if(DrawOperation != null)
               DrawOperation.Draw(spriteBatch, drawMode, DrawSpace);

            if (baseAttachment != null)
                baseAttachment.Draw(spriteBatch, drawMode, DrawSpace);
            
        }

        public void DestroyMe()
        {
            rigid.MarkedForDeletion = true;
            if (baseAttachment != null)
            {
                baseAttachment.Disable();
                baseAttachment = null;
            }
            DrawOperation = null;
        }
    }
}
